<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="courseConsumeList" >
      <el-table-column label="课程消费编号" align="center" prop="courseConsumeId"/>
      <el-table-column label="用户姓名" align="center" prop="nickName"/>
      <el-table-column label="选择康复师" align="center" prop="mainOrSpare" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_main_or_spare" :value="scope.row.mainOrSpare"/>
        </template>
      </el-table-column>
      <el-table-column label="选择康复师名字" align="center" prop="choicTheRehName"/>
      <el-table-column label="课程类型" align="center" prop="courseType" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_packaged_course" :value="scope.row.courseType"/>
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="status" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_sign_status" :value="scope.row.status"/>
        </template>
      </el-table-column>
      <el-table-column label="预约时间" align="center" prop="appointmentTime" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listCourserConsume } from "@/api/system/CourseConsume";

export default {
  name: "CourseData",
  dicts: ['sys_sign_status', 'sys_packaged_course','sys_main_or_spare'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        courseId: undefined
      },
      // 课程消费情况
      courseConsumeList: []
    };
  },
  created() {
    const param = this.$route.params && this.$route.params.courseId;
    this.queryParams.courseId = param;
    this.getList();
  },
  methods: {
    /** 查询公告列表 */
    getList() {
      this.loading = true;
      listCourserConsume(this.queryParams).then(response => {
        this.courseConsumeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
  }
};
</script>
